<template>
  <view
    @click="click"
    class="btn w-[176rpx] h-[56rpx] relative flex items-center justify-center">
    <up-image
      class="absolute top-0 left-0"
      :src="btn_mask"
      width="100%"
      height="100%"
      bgColor="transparent"></up-image>
    <view class="font-heiti text-[32rpx] text-white relative z-10">{{
      text
    }}</view>
  </view>
</template>

<script setup>
import btn_mask from "@/static/images/gift/btn_mask.png";
const props = defineProps({
  text: {
    type: String,
    default: "",
  },
});
const emit = defineEmits(["click"]);
const click = () => {
  emit("click");
};
</script>

<style lang="scss" scoped>
.btn {
  overflow: hidden;
  border-radius: 8rpx;
}
.btn::before {
  content: "";
  position: absolute;
  width: 200%;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  right: 0;
  bottom: 0;
  background: radial-gradient(at center, transparent 0%, #b0112b 100%);
  opacity: 1;
  animation: opacityTransition 1s infinite alternate;
}
@keyframes opacityTransition {
  0% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}
</style>
